/**
 *
 * @param key 设置缓存
 * @returns
 */
export function localGet(key) {
  const value = window.localStorage.getItem(key);
  try {
    return JSON.parse(<string>window.localStorage.getItem(key));
  } catch (error) {
    return value;
  }
}

/**
 * 获取缓存
 * @param key key
 * @param value value
 */
export function localSet(key, value) {
  window.localStorage.setItem(key, JSON.stringify(value));
}

/**
 * 删除缓存
 * @param key
 */

export function localRemove(key) {
  window.localStorage.removeItem(key);
}
